--- Support for identifiers starting with an underscore
module tests.hcm.Identifiers where

_f :: C _a => _a -> String
_f _x = _g _x ++ "identifiers and type variable may start with underscores"

class C _a where
  _g :: _a -> String

instance C Bool where
  _g _a = show _a ++ " success"

-- No conflict between mangled java keywords and corresponding
-- identifiers starting with an underscore.
final :: String
final = "final"

_final :: String
_final = "_final"


-- Replacement for graphic characters still works.
a ® b = "®"

-- Works for record field names as well.
data Rec = Rec { _name :: String }

_r :: Rec -> Rec
_r r = r.{ _name = "newName"}

-- An identifier can contain an arbitrary number apostrophes
a'a' :: a' -> a'
a'a' a' = a'

a''a'' :: a'' -> a''
a''a'' a'' = a''

f' :: a -> a -> a
f' a b = a

main :: IO ()
main = do 
  putStrLn $ "Hi" `f'` "ignore"

